import {request} from "../request";
import {utils} from "../../common/utils";

//1.查询流程
export function getProcessList({classifyId,keyword,start,end}){
    return request({
        url: '/sys/process/query',
        method: 'get',
        params:{
            classifyId,
            keyword,
            start,
            end
        }
    })
}

//2.添加流程
export function addProcess(process) {
    return request({
        url: '/sys/process/add',
        method: 'post',
        data: process
    })
}

//3.修改流程
export function updateProcess(process) {
    return request({
        url: '/sys/process/update',
        method: 'put',
        data: process
    })
}

//4.删除流程
export function deleteProcess(ids) {
    let strUrl = utils.joinArrayReqParam(ids,'ids')
    return request({
        url: '/sys/process/delete' + strUrl,
        method: 'delete'
    })
}

//5、查看同类别是否有相同名称的流程
export function hasSameNameSibling({id,name,classifyId}){
    return request({
        url: '/sys/process/has-same-name-sibling',
        method: 'get',
        params:{
            id,
            name,
            classifyId
        }
    })
}

//6、查询是否有相同类别的流程
export function hasSameCodeSibling({id,code}){
    return request({
        url: '/sys/process/has-same-code-sibling',
        method: 'get',
        params:{
            id,
            code
        }
    })
}